(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 11.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       158,          7]
NotebookDataLength[     33800,        798]
NotebookOptionsPosition[     32535,        753]
NotebookOutlinePosition[     32972,        772]
CellTagsIndexPosition[     32929,        769]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[
 StyleBox["BVH\:52a0\:901f\:7ed3\:6784", "Title"]], "Input",
 CellFrame->{{0, 0}, {0.5, 0}},
 CellGroupingRules->{"GroupTogetherGrouping", 10000.},
 CellChangeTimes->{{3.817331932618697*^9, 3.8173319460104628`*^9}, 
   3.817348546926899*^9, {3.817357762925655*^9, 3.8173577657199345`*^9}, 
   3.817521823174597*^9, 3.817616139023605*^9, 3.817618174598412*^9, 
   3.817690181898816*^9, 3.8177897710308266`*^9, {3.817966114956794*^9, 
   3.817966134730771*^9}, {3.8181309248537493`*^9, 3.8181309299042544`*^9}, {
   3.8206340517794085`*^9, 3.8206340537116013`*^9}, {3.820874431194681*^9, 
   3.820874441146676*^9}},
 TextAlignment->Center],

Cell[BoxData[
 StyleBox["\:7b80\:4ecb", "Subsubsection"]], "Input",
 CellChangeTimes->{3.8208751761551695`*^9},
 TextAlignment->Center],

Cell[BoxData[
 StyleBox[
  RowBox[{
  "\:5728\:4e4b\:524d\:7684\:6e32\:67d3\:8fc7\:7a0b\:4e2d", "\:ff0c", 
   "\:6bcf\:6761\:5149\:7ebf\:4e0e\:7269\:4f53\:6c42\:4ea4\:70b9\:90fd\:8981\
\:628a\:573a\:666f\:4e2d\:6240\:6709\:7269\:4f53\:904d\:5386\:4e00\:904d", 
   "\:3002", 
   "BVH\:6784\:5efa\:5305\:56f4\:76d2\:52a0\:901f\:8fd9\:4e2a\:8fc7\:7a0b", 
   "\:ff0c", "BVH\:6811\:662f\:4e00\:79cd\:4e8c\:53c9\:6811", "\:ff0c", 
   "\:6bcf\:4e00\:4e2a\:8282\:70b9\:8bb0\:5f55\:4e86\:5b83\:81ea\:5df1\:7684\
\:5305\:56f4\:76d2", "\:3002", "\:5bf9\:4e8e\:53f6\:5b50\:8282\:70b9", 
   "\:ff0c", 
   "\:5b83\:5b58\:50a8\:4e86\:5b83\:6240\:5305\:542b\:7684\:6240\:6709\:56fe\
\:5143", "\:ff1b", "\:5bf9\:4e8e\:975e\:53f6\:5b50\:8282\:70b9", "\:ff0c", 
   "\:8bb0\:5f55\:4e86\:5b83\:6240\:5305\:542b\:7684\:5b69\:5b50\:8282\:70b9"}\
], "Subsubtitle"]], "Input",
 CellChangeTimes->{{3.8208746116967297`*^9, 3.820874621647724*^9}, {
  3.820875036438199*^9, 3.8208751659911537`*^9}, {3.820903077409374*^9, 
  3.820903106420275*^9}},
 TextAlignment->Center],

Cell[BoxData[
 StyleBox["wolfram\:6811\:7ed3\:6784", "Subsubsection"]], "Input",
 CellChangeTimes->{{3.8208752441799717`*^9, 3.820875252307784*^9}, {
  3.8208934285962734`*^9, 3.8208934287542896`*^9}},
 TextAlignment->Center],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"TreeGraph", "[", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"a", "\[DirectedEdge]", "b"}], ",", 
    RowBox[{"a", "\[DirectedEdge]", "c"}], ",", 
    RowBox[{"b", "\[DirectedEdge]", "d"}], ",", 
    RowBox[{"b", "\[DirectedEdge]", "e"}]}], "}"}], "]"}]], "Input",
 CellChangeTimes->{{3.8208752716927223`*^9, 3.8208752947140245`*^9}, {
  3.8208756392114706`*^9, 3.820875641147664*^9}, {3.82087572741429*^9, 
  3.820875733900939*^9}, {3.820876859645441*^9, 3.8208768802784405`*^9}}],

Cell[BoxData[
 GraphicsBox[
  NamespaceBox["NetworkGraphics",
   DynamicModuleBox[{Typeset`graph = HoldComplete[
     Graph[{$CellContext`a, $CellContext`b, $CellContext`c, $CellContext`d, \
$CellContext`e}, {{{1, 2}, {1, 3}, {2, 4}, {2, 5}}, Null}]]}, 
    TagBox[
     GraphicsGroupBox[
      GraphicsComplexBox[{{0.8944271909999159, 1.7888543819998317`}, {
       0.4472135954999579, 0.8944271909999159}, {1.3416407864998738`, 
       0.8944271909999159}, {0., 0.}, {0.8944271909999159, 0.}}, {
        {Hue[0.6, 0.7, 0.5], Opacity[0.7], Arrowheads[Medium], 
         ArrowBox[{{1, 2}, {1, 3}, {2, 4}, {2, 5}}, 0.020874891668923312`]}, 
        {Hue[0.6, 0.2, 0.8], EdgeForm[{GrayLevel[0], Opacity[0.7]}], 
         DiskBox[1, 0.020874891668923312], DiskBox[2, 0.020874891668923312], 
         DiskBox[3, 0.020874891668923312], DiskBox[4, 0.020874891668923312], 
         DiskBox[5, 0.020874891668923312]}}]],
     MouseAppearanceTag["NetworkGraphics"]],
    AllowKernelInitialization->False]],
  DefaultBaseStyle->{
   "NetworkGraphics", FrontEnd`GraphicsHighlightColor -> Hue[0.8, 1., 0.6]},
  FormatType->TraditionalForm,
  FrameTicks->None,
  ImageSize->{73.846153846155, Automatic}]], "Output",
 CellChangeTimes->{{3.820875281246678*^9, 3.8208752952430773`*^9}, 
   3.8208756424207916`*^9, 3.8208757347450233`*^9, {3.820876871142441*^9, 
   3.8208768811254406`*^9}, 3.8254569903457603`*^9}]
}, Open  ]],

Cell[BoxData[
 StyleBox[
  RowBox[{"\:5355\:4e2a\:7269\:4f53\:5305\:56f4\:76d2", "\:ff1a", 
   RowBox[{"\:5706\:5fc3", "+", 
    RowBox[{"-", "\:534a\:5f84"}]}]}], "Subsubsection"]], "Input",
 CellChangeTimes->{{3.8208753794424963`*^9, 3.8208753834758997`*^9}, {
  3.820888412900745*^9, 3.820888419904445*^9}},
 TextAlignment->Center],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Graphics3D", "[", 
  RowBox[{
   RowBox[{"{", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"Sphere", "[", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{"0", ",", "0", ",", "0"}], "}"}], ",", "0.5"}], "]"}], ",", 
     "\[IndentingNewLine]", 
     RowBox[{"Opacity", "[", "0.5", "]"}], ",", 
     RowBox[{"Cuboid", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"{", 
         RowBox[{"0", ",", "0", ",", "0"}], "}"}], "-", "0.5"}], ",", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{"0", ",", "0", ",", "0"}], "}"}], "+", "0.5"}]}], "]"}]}], 
    "\[IndentingNewLine]", "}"}], ",", 
   RowBox[{"PlotRange", "\[Rule]", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{
        RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", 
      RowBox[{"{", 
       RowBox[{
        RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", 
      RowBox[{"{", 
       RowBox[{
        RowBox[{"-", "1"}], ",", "1"}], "}"}]}], "}"}]}], ",", 
   RowBox[{"Axes", "\[Rule]", "True"}]}], "\[IndentingNewLine]", 
  "]"}]], "Input",
 CellChangeTimes->{{3.8208754119837503`*^9, 3.820875547474298*^9}, {
  3.8208761832958736`*^9, 3.8208762731848617`*^9}, {3.820876370504441*^9, 
  3.820876377468441*^9}, {3.820890368696305*^9, 3.820890375388974*^9}}],

Cell[BoxData[
 Graphics3DBox[{SphereBox[{0, 0, 0}, 0.5], 
   {Opacity[0.5], CuboidBox[{-0.5, -0.5, -0.5}, {0.5, 0.5, 0.5}]}},
  Axes->True,
  ImageSize->{290.7160276107131, 292.7407019108455},
  PlotRange->{{-1, 1}, {-1, 1}, {-1, 1}},
  ViewPoint->{-2.556002896075744, -1.5468571719318507`, 1.5887360022657693`},
  ViewVertical->{-0.020445502332184118`, -0.27063946598937666`, 
   0.9624636413306062}]], "Output",
 CellChangeTimes->{{3.8208754601175632`*^9, 3.8208755378313336`*^9}, 
   3.8208762738829317`*^9, 3.820876377916441*^9, 3.82089037604704*^9, 
   3.825456991607887*^9}]
}, Open  ]],

Cell[BoxData[
 StyleBox["\:591a\:4e2a\:7269\:4f53\:5305\:56f4\:76d2", 
  "Subsubsection"]], "Input",
 CellChangeTimes->{{3.8208753794424963`*^9, 3.8208753834758997`*^9}, {
  3.820888412900745*^9, 3.820888445428997*^9}},
 TextAlignment->Center],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"(*", 
   RowBox[{
   "\:7403\:4f53\:5bf9\:8c61", "\:ff0c", 
    "\:7531\:7403\:5fc3\:534a\:5f84\:5b9a\:4e49"}], "*)"}], 
  "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{
    RowBox[{
     RowBox[{"sphere", "[", 
      RowBox[{"center_", ",", "radius_"}], "]"}], "=", 
     RowBox[{"(", 
      RowBox[{"{", 
       RowBox[{"center", ",", "radius"}], "}"}], ")"}]}], ";"}], 
   "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"ts1", "=", 
     RowBox[{"sphere", "[", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
         RowBox[{"-", "0.5"}], ",", "0", ",", "0"}], "}"}], ",", "0.3"}], 
      "]"}]}], ";"}], "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"ts2", "=", 
     RowBox[{"sphere", "[", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{"0.5", ",", "0.5", ",", 
         RowBox[{"-", "0.5"}]}], "}"}], ",", "0.2"}], "]"}]}], ";"}], 
   "\[IndentingNewLine]", 
   RowBox[{"(*", 
    RowBox[{
     RowBox[{"TreeNode\:5bf9\:8c61left", " ", "right\:4e5f\:662fTreeNode"}], 
     "\:ff0c", "\:6811\:5e72\:8282\:70b9\:6ca1\:6709sphere", "\:ff0c", 
     RowBox[{"\:53f6\:5b50\:8282\:70b9\:6ca1\:6709left", " ", "right"}]}], 
    "*)"}], "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{
     RowBox[{"treeNode", "[", 
      RowBox[{"left_", ",", "right_", ",", "box_", ",", "object_"}], "]"}], 
     "=", 
     RowBox[{"(", 
      RowBox[{"{", 
       RowBox[{"left", ",", "right", ",", "box", ",", "objetc"}], "}"}], 
      ")"}]}], ";"}], "\[IndentingNewLine]", 
   RowBox[{
   "(*", "\:83b7\:53d6\:5355\:4e2a\:7403\:7684\:5305\:56f4\:76d2", "*)"}], 
   "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{
     RowBox[{"getSingleBox", "[", "object_", "]"}], ":=", 
     RowBox[{"(", "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
        RowBox[{
         RowBox[{"object", "[", 
          RowBox[{"[", "1", "]"}], "]"}], "-", 
         RowBox[{"object", "[", 
          RowBox[{"[", "2", "]"}], "]"}]}], ",", 
        RowBox[{
         RowBox[{"object", "[", 
          RowBox[{"[", "1", "]"}], "]"}], "+", 
         RowBox[{"object", "[", 
          RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], "\[IndentingNewLine]", 
      ")"}]}], ";"}], "\[IndentingNewLine]", 
   RowBox[{"(*", 
    RowBox[{
    "\:83b7\:53d6\:4e24\:4e2a\:7403\:7684\:5305\:56f4\:76d2", "\:ff0c", 
     "\:5148\:7b97\:6bcf\:4e2a\:6c42\:5305\:56f4\:76d2", "\:ff0c", 
     "\:518d\:53d6\:6700\:5927\:6700\:5c0f\:5750\:6807"}], "*)"}], 
   "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{
     RowBox[{"getPairBox", "[", 
      RowBox[{"s1_", ",", "s2_"}], "]"}], ":=", 
     RowBox[{"(", "\[IndentingNewLine]", 
      RowBox[{
       RowBox[{"bs1", "=", 
        RowBox[{"getSingleBox", "[", "s1", "]"}]}], ";", 
       "\[IndentingNewLine]", 
       RowBox[{"bs2", "=", 
        RowBox[{"getSingleBox", "[", "s2", "]"}]}], ";", 
       "\[IndentingNewLine]", "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{
           RowBox[{"Min", "[", 
            RowBox[{
             RowBox[{
              RowBox[{"bs1", "[", 
               RowBox[{"[", "1", "]"}], "]"}], "[", 
              RowBox[{"[", "1", "]"}], "]"}], ",", 
             RowBox[{
              RowBox[{"bs2", "[", 
               RowBox[{"[", "1", "]"}], "]"}], "[", 
              RowBox[{"[", "1", "]"}], "]"}]}], "]"}], ",", 
           RowBox[{"Min", "[", 
            RowBox[{
             RowBox[{
              RowBox[{"bs1", "[", 
               RowBox[{"[", "1", "]"}], "]"}], "[", 
              RowBox[{"[", "2", "]"}], "]"}], ",", 
             RowBox[{
              RowBox[{"bs2", "[", 
               RowBox[{"[", "1", "]"}], "]"}], "[", 
              RowBox[{"[", "2", "]"}], "]"}]}], "]"}], ",", 
           RowBox[{"Min", "[", 
            RowBox[{
             RowBox[{
              RowBox[{"bs1", "[", 
               RowBox[{"[", "1", "]"}], "]"}], "[", 
              RowBox[{"[", "3", "]"}], "]"}], ",", 
             RowBox[{
              RowBox[{"bs2", "[", 
               RowBox[{"[", "1", "]"}], "]"}], "[", 
              RowBox[{"[", "3", "]"}], "]"}]}], "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{
           RowBox[{"Max", "[", 
            RowBox[{
             RowBox[{
              RowBox[{"bs1", "[", 
               RowBox[{"[", "2", "]"}], "]"}], "[", 
              RowBox[{"[", "1", "]"}], "]"}], ",", 
             RowBox[{
              RowBox[{"bs2", "[", 
               RowBox[{"[", "2", "]"}], "]"}], "[", 
              RowBox[{"[", "1", "]"}], "]"}]}], "]"}], ",", 
           RowBox[{"Max", "[", 
            RowBox[{
             RowBox[{
              RowBox[{"bs1", "[", 
               RowBox[{"[", "2", "]"}], "]"}], "[", 
              RowBox[{"[", "2", "]"}], "]"}], ",", 
             RowBox[{
              RowBox[{"bs2", "[", 
               RowBox[{"[", "2", "]"}], "]"}], "[", 
              RowBox[{"[", "2", "]"}], "]"}]}], "]"}], ",", 
           RowBox[{"Max", "[", 
            RowBox[{
             RowBox[{
              RowBox[{"bs1", "[", 
               RowBox[{"[", "2", "]"}], "]"}], "[", 
              RowBox[{"[", "3", "]"}], "]"}], ",", 
             RowBox[{
              RowBox[{"bs2", "[", 
               RowBox[{"[", "2", "]"}], "]"}], "[", 
              RowBox[{"[", "3", "]"}], "]"}]}], "]"}]}], "}"}]}], "}"}]}], 
      "\[IndentingNewLine]", ")"}]}], ";"}], "\[IndentingNewLine]", 
   RowBox[{"Graphics3D", "[", 
    RowBox[{
     RowBox[{"{", "\[IndentingNewLine]", 
      RowBox[{
       RowBox[{"Sphere", "[", 
        RowBox[{
         RowBox[{"ts1", "[", 
          RowBox[{"[", "1", "]"}], "]"}], ",", 
         RowBox[{"ts1", "[", 
          RowBox[{"[", "2", "]"}], "]"}]}], "]"}], ",", 
       RowBox[{"Sphere", "[", 
        RowBox[{
         RowBox[{"ts2", "[", 
          RowBox[{"[", "1", "]"}], "]"}], ",", 
         RowBox[{"ts2", "[", 
          RowBox[{"[", "2", "]"}], "]"}]}], "]"}], ",", "\[IndentingNewLine]", 
       RowBox[{"Opacity", "[", "0.1", "]"}], ",", 
       RowBox[{"Cuboid", "[", 
        RowBox[{"getSingleBox", "[", "ts1", "]"}], "]"}], ",", 
       RowBox[{"Cuboid", "[", 
        RowBox[{"getSingleBox", "[", "ts2", "]"}], "]"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"Cuboid", "[", 
        RowBox[{"getPairBox", "[", 
         RowBox[{"ts1", ",", "ts2"}], "]"}], "]"}]}], "\[IndentingNewLine]", 
      "}"}], ",", 
     RowBox[{"PlotRange", "\[Rule]", 
      RowBox[{"{", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{
          RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", 
        RowBox[{"{", 
         RowBox[{
          RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", 
        RowBox[{"{", 
         RowBox[{
          RowBox[{"-", "1"}], ",", "1"}], "}"}]}], "}"}]}], ",", 
     RowBox[{"Axes", "\[Rule]", "True"}]}], "]"}]}]}]], "Input",
 CellChangeTimes->{{3.8209043938220024`*^9, 3.8209044162892494`*^9}, 
   3.820904617595378*^9, {3.820905369415592*^9, 3.8209053695715923`*^9}, {
   3.8209054466842833`*^9, 3.820905503288943*^9}, {3.820959942154384*^9, 
   3.8209599532339554`*^9}, {3.820960335335397*^9, 3.8209605122724295`*^9}, {
   3.820960614856908*^9, 3.820960755393013*^9}, {3.8209610728710127`*^9, 
   3.820961224273013*^9}, {3.820961263889013*^9, 3.8209612988210125`*^9}, {
   3.8209613486860127`*^9, 3.820961395490013*^9}, {3.820961459000013*^9, 
   3.820961473415013*^9}, {3.820961567681013*^9, 3.8209616021230125`*^9}, {
   3.8209616403900127`*^9, 3.820961651777013*^9}, {3.820961684743013*^9, 
   3.8209616853520126`*^9}, {3.820961736221013*^9, 3.8209617646020126`*^9}, {
   3.8209618106022477`*^9, 3.8209618169718847`*^9}, {3.8209618506832557`*^9, 
   3.8209618533355207`*^9}, {3.820961893276514*^9, 3.820961957523938*^9}, {
   3.8209620579379787`*^9, 3.820962122507435*^9}, {3.8254572338191056`*^9, 
   3.8254572650932326`*^9}, {3.82545730687241*^9, 3.825457387367459*^9}}],

Cell[BoxData[
 Graphics3DBox[{SphereBox[{-0.5, 0, 0}, 0.3], 
   SphereBox[{0.5, 0.5, -0.5}, 0.2], 
   {Opacity[0.1], CuboidBox[{{-0.8, -0.3, -0.3}, {-0.2, 0.3, 0.3}}], 
    CuboidBox[{{0.3, 0.3, -0.7}, {0.7, 0.7, -0.3}}], 
    CuboidBox[{{-0.8, -0.3, -0.7}, {0.7, 0.7, 0.3}}]}},
  Axes->True,
  ImageSize->{412.79477125962285`, 442.389804699621},
  PlotRange->{{-1, 1}, {-1, 1}, {-1, 1}},
  ViewPoint->{0.3809312084528043, -3.239744725891116, 0.8994139900442856},
  ViewVertical->{0.10349201157378146`, -0.3463142519557633, 
   0.9323925366672197}]], "Output",
 CellChangeTimes->{{3.820962115985783*^9, 3.820962125225707*^9}, {
   3.825456993929119*^9, 3.8254570086925955`*^9}, 3.8254572657813015`*^9, 
   3.8254573884365654`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 StyleBox["\:5b9a\:4e49\:573a\:666f", "Subsubsection"]], "Input",
 CellGroupingRules->{"GroupTogetherGrouping", 10001.},
 CellChangeTimes->{{3.8173319710178933`*^9, 3.8173319847946815`*^9}, 
   3.817332046959237*^9, 3.8173485841018457`*^9, 3.817348654194854*^9, {
   3.8173586705394073`*^9, 3.817358672035557*^9}, 3.8174156245735397`*^9, {
   3.817415663231971*^9, 3.8174156701883745`*^9}},
 TextAlignment->Center],

Cell[BoxData[{
 RowBox[{
  RowBox[{"centerRange", "=", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"-", "2"}], ",", "2"}], "}"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"radiusRange", "=", 
   RowBox[{"{", 
    RowBox[{"0.1", ",", "0.5"}], "}"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"world", "=", 
   RowBox[{"{", "}"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"For", "[", 
    RowBox[{
     RowBox[{"i", "=", "0"}], ",", 
     RowBox[{"i", "<", "10"}], ",", 
     RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
     RowBox[{"AppendTo", "[", 
      RowBox[{"world", ",", 
       RowBox[{"sphere", "[", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{
           RowBox[{"RandomReal", "[", "centerRange", "]"}], ",", 
           RowBox[{"RandomReal", "[", "centerRange", "]"}], ",", 
           RowBox[{"RandomReal", "[", "centerRange", "]"}]}], "}"}], ",", 
         RowBox[{"RandomReal", "[", "radiusRange", "]"}]}], "]"}]}], "]"}]}], 
    "\[IndentingNewLine]", "]"}], ";"}], "\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{
   "\:5148\:5bf9\:573a\:666f\:7269\:4f53\:6392\:5e8f", "\:ff0c", 
    "\:968f\:4fbf\:9009\:53d6\:4e00\:4e2a\:8f74\:5411\:8fd9\:91cc\:662fx\:8f74\
", "\:ff0c", "\:4ece\:5c0f\:5230\:5927"}], "*)"}]}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"world", "=", 
    RowBox[{"SortBy", "[", 
     RowBox[{"world", ",", 
      RowBox[{
       RowBox[{
        RowBox[{"#", "[", "1", "]"}], "[", "1", "]"}], "&"}]}], "]"}]}], 
   ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"getBox", "[", 
    RowBox[{"objects_", ",", "tree_"}], "]"}], ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{"Switch", "[", 
     RowBox[{
      RowBox[{"Length", "[", "objects", "]"}], ",", "\[IndentingNewLine]", 
      "1", ",", "\[IndentingNewLine]", 
      RowBox[{
       RowBox[{"treeNode", "[", 
        RowBox[{"Null", ",", "Null", ",", 
         RowBox[{"{", 
          RowBox[{
           RowBox[{
            RowBox[{
             RowBox[{"objects", "[", 
              RowBox[{"[", "1", "]"}], "]"}], "[", 
             RowBox[{"[", "1", "]"}], "]"}], "+", 
            RowBox[{
             RowBox[{"objects", "[", 
              RowBox[{"[", "1", "]"}], "]"}], "[", 
             RowBox[{"[", "2", "]"}], "]"}]}], ",", 
           RowBox[{
            RowBox[{
             RowBox[{"objects", "[", 
              RowBox[{"[", "1", "]"}], "]"}], "[", 
             RowBox[{"[", "1", "]"}], "]"}], "-", 
            RowBox[{
             RowBox[{"objects", "[", 
              RowBox[{"[", "1", "]"}], "]"}], "[", 
             RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", 
         RowBox[{"objects", "[", 
          RowBox[{"[", "1", "]"}], "]"}]}], "]"}], "\[IndentingNewLine]", 
       "2"}], ",", 
      RowBox[{
       RowBox[{
        RowBox[{"$Failed", "\[IndentingNewLine]", "left"}], "=", 
        RowBox[{"treeNode", "[", 
         RowBox[{"Null", ",", "Null", ",", 
          RowBox[{"{", 
           RowBox[{
            RowBox[{
             RowBox[{
              RowBox[{"objects", "[", 
               RowBox[{"[", "1", "]"}], "]"}], "[", 
              RowBox[{"[", "1", "]"}], "]"}], "+", 
             RowBox[{
              RowBox[{"objects", "[", 
               RowBox[{"[", "1", "]"}], "]"}], "[", 
              RowBox[{"[", "2", "]"}], "]"}]}], ",", 
            RowBox[{
             RowBox[{
              RowBox[{"objects", "[", 
               RowBox[{"[", "1", "]"}], "]"}], "[", 
              RowBox[{"[", "1", "]"}], "]"}], "-", 
             RowBox[{
              RowBox[{"objects", "[", 
               RowBox[{"[", "1", "]"}], "]"}], "[", 
              RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", 
          RowBox[{"objects", "[", 
           RowBox[{"[", "1", "]"}], "]"}]}], "]"}]}], ";", 
       "\[IndentingNewLine]", 
       RowBox[{"right", "=", 
        RowBox[{"treeNode", "[", 
         RowBox[{"Null", ",", "Null", ",", 
          RowBox[{"{", 
           RowBox[{
            RowBox[{
             RowBox[{
              RowBox[{"objects", "[", 
               RowBox[{"[", "2", "]"}], "]"}], "[", 
              RowBox[{"[", "1", "]"}], "]"}], "+", 
             RowBox[{
              RowBox[{"objects", "[", 
               RowBox[{"[", "2", "]"}], "]"}], "[", 
              RowBox[{"[", "2", "]"}], "]"}]}], ",", 
            RowBox[{
             RowBox[{
              RowBox[{"objects", "[", 
               RowBox[{"[", "2", "]"}], "]"}], "[", 
              RowBox[{"[", "1", "]"}], "]"}], "-", 
             RowBox[{
              RowBox[{"objects", "[", 
               RowBox[{"[", "2", "]"}], "]"}], "[", 
              RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", 
          RowBox[{"objects", "[", 
           RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], ";", 
       "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"treeNode", "[", 
         RowBox[{"left", ",", "right", ",", "box", ",", "Null"}], "]"}], 
        "\[IndentingNewLine]", "3"}]}], ",", "\[IndentingNewLine]", 
      RowBox[{
       RowBox[{"left", "=", 
        RowBox[{"getBox", "[", "]"}]}], ";", "\[IndentingNewLine]", 
       RowBox[{"right", "=", 
        RowBox[{"getBox", "[", "]"}]}], ";"}]}], "\[IndentingNewLine]", "]"}],
     "\[IndentingNewLine]", ")"}]}], ";"}]}], "Input",
 CellGroupingRules->{"GroupTogetherGrouping", 10001.},
 CellChangeTimes->{{3.8173320303312855`*^9, 3.8173320469602365`*^9}, {
   3.8173320976091337`*^9, 3.817332104687539*^9}, 3.8173327535876536`*^9, {
   3.817334078691467*^9, 3.817334078870999*^9}, {3.817334401593808*^9, 
   3.817334545305629*^9}, 3.8173353934318776`*^9, 3.817335450314565*^9, {
   3.8173371538839054`*^9, 3.817337165772094*^9}, {3.817337391527667*^9, 
   3.8173374670579495`*^9}, 3.8173485841018457`*^9, {3.817354088726267*^9, 
   3.81735411975737*^9}, {3.8173578229806595`*^9, 3.8173578388682485`*^9}, {
   3.817357998663226*^9, 3.817358040338393*^9}, {3.8173585716345177`*^9, 
   3.817358615119866*^9}, 3.8174156245735397`*^9, {3.817415663231971*^9, 
   3.8174156701883745`*^9}, {3.817417981841733*^9, 3.8174179859098587`*^9}, 
   3.817419855445687*^9, {3.8174206474975386`*^9, 3.817420649343106*^9}, {
   3.8175246100955315`*^9, 3.8175246885613775`*^9}, {3.8175247358871098`*^9, 
   3.817524736704191*^9}, {3.8175267782593307`*^9, 3.8175267854930544`*^9}, {
   3.81752683014952*^9, 3.8175268588203864`*^9}, 3.817531663891855*^9, 
   3.8175321000704684`*^9, {3.817533784172277*^9, 3.8175338398218412`*^9}, 
   3.81753387771063*^9, 3.8175339468135395`*^9, {3.8175353366615105`*^9, 
   3.8175353385727015`*^9}, {3.817535379122756*^9, 3.8175354017130146`*^9}, {
   3.8175976803041363`*^9, 3.8175976829484005`*^9}, {3.817605073461396*^9, 
   3.8176050950825586`*^9}, {3.8176903015387793`*^9, 
   3.8176903354971747`*^9}, {3.817691186614278*^9, 3.8176911916617823`*^9}, {
   3.8176912344660625`*^9, 3.8176912347020864`*^9}, {3.8176912718478003`*^9, 
   3.817691283185934*^9}, {3.817691326101225*^9, 3.8176914128318977`*^9}, {
   3.817691847060316*^9, 3.8176919379053993`*^9}, 3.8176961701005907`*^9, {
   3.8177775095841255`*^9, 3.817777524896126*^9}, {3.817777557286126*^9, 
   3.817777604671126*^9}, {3.8177783212379384`*^9, 3.817778324974312*^9}, {
   3.8177783755723715`*^9, 3.817778378248639*^9}, {3.817778708599671*^9, 
   3.817778711710982*^9}, {3.817778866898499*^9, 3.817778870244834*^9}, {
   3.8177793573335376`*^9, 3.8177793959934034`*^9}, {3.817787910752808*^9, 
   3.817787912223955*^9}, {3.8177897813308563`*^9, 3.817789812436967*^9}, {
   3.817789856734396*^9, 3.81778992688041*^9}, {3.8177901589136114`*^9, 
   3.817790191329852*^9}, 3.817793591939889*^9, {3.8177936351192064`*^9, 
   3.8177937567523685`*^9}, {3.8177939075654483`*^9, 
   3.8177940042261133`*^9}, {3.8177940417808685`*^9, 3.817794118348524*^9}, {
   3.8177941719768867`*^9, 3.8177941911088*^9}, {3.817794222857974*^9, 
   3.817794223693058*^9}, {3.817794281548843*^9, 3.8177943070193896`*^9}, {
   3.8177945740650916`*^9, 3.817794576628348*^9}, {3.817794627901475*^9, 
   3.8177946565753417`*^9}, {3.817865848595995*^9, 3.817865851567292*^9}, {
   3.817866278599991*^9, 3.8178662822713585`*^9}, {3.817866477614891*^9, 
   3.8178664797441034`*^9}, {3.8178815198429956`*^9, 3.817881522814293*^9}, {
   3.8179584448898497`*^9, 3.817958452975658*^9}, {3.817961979962331*^9, 
   3.817961982642599*^9}, {3.8179625736616945`*^9, 3.8179625743107595`*^9}, {
   3.8179656420285053`*^9, 3.8179656461569185`*^9}, 3.818133783971633*^9, {
   3.8183076176992254`*^9, 3.8183076185683126`*^9}, 3.8206312017514343`*^9, {
   3.8206320582860794`*^9, 3.820632060805331*^9}, {3.8206337931735506`*^9, 
   3.820633807142947*^9}, {3.8206339067759094`*^9, 3.820633928463078*^9}, {
   3.8206339853027616`*^9, 3.8206339960628376`*^9}, {3.8206351943736563`*^9, 
   3.8206352509763165`*^9}, {3.820635783792592*^9, 3.8206358323784504`*^9}, {
   3.820636150652275*^9, 3.8206362271479235`*^9}, {3.820636860763487*^9, 
   3.820636892868487*^9}, {3.820643745900738*^9, 3.820643749557103*^9}, {
   3.820643782057353*^9, 3.820643784855633*^9}, {3.820643828917039*^9, 
   3.820643863383485*^9}, {3.8206439769858437`*^9, 3.8206440533114758`*^9}, {
   3.8206446669678354`*^9, 3.8206446933204703`*^9}, {3.8206447378189197`*^9, 
   3.8206447564387817`*^9}, {3.8206448087240095`*^9, 3.820644836243761*^9}, {
   3.820644868441981*^9, 3.8206448748506217`*^9}, {3.820644928366973*^9, 
   3.8206449328854246`*^9}, {3.820700306532063*^9, 3.820700319167007*^9}, {
   3.82070263470467*^9, 3.820702637097909*^9}, {3.820703367063898*^9, 
   3.8207034283060217`*^9}, 3.820703767894977*^9, 3.8207042440445876`*^9, {
   3.8207048214213195`*^9, 3.8207048271298904`*^9}, {3.8207050860917835`*^9, 
   3.820705087116886*^9}, {3.820705426736845*^9, 3.8207054288560567`*^9}, {
   3.8207063518643484`*^9, 3.820706354213583*^9}, 3.8207149780559096`*^9, {
   3.8207187408461604`*^9, 3.820718742332309*^9}, {3.8207190208281555`*^9, 
   3.8207190484979224`*^9}, {3.8207202032563868`*^9, 
   3.8207202034204035`*^9}, {3.8207206961066666`*^9, 3.820720698600916*^9}, {
   3.8207244712791557`*^9, 3.8207244818352113`*^9}, {3.820724511986226*^9, 
   3.8207245880358305`*^9}, {3.8207250991475067`*^9, 3.820725100370507*^9}, {
   3.820874496403201*^9, 3.820874506652226*^9}, {3.820874536734234*^9, 
   3.8208745896765275`*^9}, {3.820876421693441*^9, 3.820876431655441*^9}, {
   3.8208764663234406`*^9, 3.820876545999441*^9}, {3.820876927448291*^9, 
   3.820876978768422*^9}, {3.8208771031408587`*^9, 3.8208771863501787`*^9}, {
   3.820877237317275*^9, 3.8208772842109632`*^9}, {3.8208902218996267`*^9, 
   3.820890222083645*^9}, {3.8208907519703703`*^9, 3.82089076300537*^9}, {
   3.8208911779703703`*^9, 3.820891290577493*^9}, {3.820893115748992*^9, 
   3.820893116838101*^9}, {3.8208933762100353`*^9, 3.8208933961720314`*^9}, {
   3.8208935093173447`*^9, 3.8208935668740997`*^9}, {3.820894240434449*^9, 
   3.82089424544095*^9}, {3.8208945688293533`*^9, 3.820894571189353*^9}, {
   3.8208952739167967`*^9, 3.8208953707544794`*^9}, {3.8208969968600736`*^9, 
   3.820897003232711*^9}, {3.820897053092696*^9, 3.8208970802864156`*^9}, {
   3.820897508350218*^9, 3.8208975587352557`*^9}, {3.820898002397336*^9, 
   3.820898033947336*^9}, {3.82089882615899*^9, 3.820898829349309*^9}, {
   3.820899004315804*^9, 3.820899025507923*^9}, {3.820901529836317*^9, 
   3.820901627722317*^9}, {3.8209016995543175`*^9, 3.8209017041363173`*^9}, {
   3.8209017863043175`*^9, 3.820901884600317*^9}, {3.820901922906317*^9, 
   3.820901929277317*^9}, 3.8209019730403175`*^9, {3.8209035247060995`*^9, 
   3.820903530748704*^9}, {3.820903562402869*^9, 3.8209035632219505`*^9}, {
   3.8209035992615547`*^9, 3.8209036916107883`*^9}, {3.8209037488295097`*^9, 
   3.820903760299657*^9}, {3.82090410356598*^9, 3.8209041731789403`*^9}, {
   3.820904236922314*^9, 3.820904250320654*^9}, {3.8209043789875193`*^9, 
   3.8209043909927197`*^9}, 3.8209044897805977`*^9, 3.825457404828205*^9, 
   3.82545780412313*^9, {3.8254590751095896`*^9, 3.8254591115622344`*^9}, {
   3.8254600405841274`*^9, 3.825460054840553*^9}, {3.8256505166613984`*^9, 
   3.8256505179875307`*^9}, 3.8256505713558674`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Graphics3D", "[", 
  RowBox[{
   RowBox[{"{", "\[IndentingNewLine]", " ", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"Map", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Sphere", "[", 
         RowBox[{
          RowBox[{"#", "[", 
           RowBox[{"[", "1", "]"}], "]"}], ",", 
          RowBox[{"#", "[", 
           RowBox[{"[", "2", "]"}], "]"}]}], "]"}], "&"}], ",", "world"}], 
      "]"}], ",", "\[IndentingNewLine]", 
     RowBox[{"Opacity", "[", "0.1", "]"}], ",", "\[IndentingNewLine]", 
     RowBox[{"Cuboid", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"{", 
         RowBox[{
          RowBox[{"centerRange", "[", 
           RowBox[{"[", "1", "]"}], "]"}], ",", 
          RowBox[{"centerRange", "[", 
           RowBox[{"[", "1", "]"}], "]"}], ",", 
          RowBox[{"centerRange", "[", 
           RowBox[{"[", "1", "]"}], "]"}]}], "}"}], "-", 
        RowBox[{"radiusRange", "[", 
         RowBox[{"[", "2", "]"}], "]"}]}], ",", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{
          RowBox[{"centerRange", "[", 
           RowBox[{"[", "2", "]"}], "]"}], ",", 
          RowBox[{"centerRange", "[", 
           RowBox[{"[", "2", "]"}], "]"}], ",", 
          RowBox[{"centerRange", "[", 
           RowBox[{"[", "2", "]"}], "]"}]}], "}"}], "+", 
        RowBox[{"radiusRange", "[", 
         RowBox[{"[", "2", "]"}], "]"}]}]}], "]"}]}], "\[IndentingNewLine]", 
    "}"}], ",", "\[IndentingNewLine]", 
   RowBox[{"Axes", "\[Rule]", "True"}], ",", 
   RowBox[{"PlotRange", "\[Rule]", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{
        RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", 
      RowBox[{"{", 
       RowBox[{
        RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", 
      RowBox[{"{", 
       RowBox[{
        RowBox[{"-", "3"}], ",", "3"}], "}"}]}], "}"}]}]}], 
  "\[IndentingNewLine]", "]"}]], "Input",
 CellChangeTimes->{{3.8208770152980747`*^9, 3.8208770765301976`*^9}, {
   3.8208773029748397`*^9, 3.8208773563901806`*^9}, {3.8208904589923334`*^9, 
   3.820890463097744*^9}, {3.8254578964363604`*^9, 3.8254579038591027`*^9}, 
   3.8256505267034025`*^9}],

Cell[BoxData[
 Graphics3DBox[{{
    SphereBox[{-1.748692920039936, 1.694426535504328, -0.6848092527693508}, 
     0.47705082288157497`], 
    SphereBox[{-1.5696175289194851`, -1.4142470385791661`, 0.312576803797489},
      0.2360162932290698], 
    SphereBox[{-1.2519634810220008`, 1.4297190670433713`, -1.593335616313226},
      0.4333485320627869], 
    SphereBox[{-0.8447972168651887, -0.6000643623655417, \
-1.9225720503643267`}, 0.12463111176281955`], 
    SphereBox[{-0.6910096970138957, 
     0.6959267448413815, -0.15218915862572224`}, 0.122154594409766], 
    SphereBox[{-0.649920310561841, 1.9045770579604788`, -0.4437655261757625}, 
     0.12408682094376827`], 
    SphereBox[{0.5149419588403257, -1.214920186875121, 1.510434208876017}, 
     0.3860795426215142], 
    SphereBox[{0.7304198632140642, -0.34324826513854134`, -1.303930302603562},
      0.1308265122209742], 
    SphereBox[{1.22805490561462, 1.547826975506105, 0.3231167484082853}, 
     0.22446353646792794`], 
    SphereBox[{
     1.4496925491187396`, -1.9715397801628631`, -1.9185930503064519`}, 
     0.359855294814434]}, 
   {Opacity[0.1], CuboidBox[{-2.5, -2.5, -2.5}, {2.5, 2.5, 2.5}]}},
  Axes->True,
  ImageSize->{638.2889321968102, 666.1538461538461},
  PlotRange->{{-3, 3}, {-3, 3}, {-3, 3}},
  ViewPoint->{0.3892956660023774, 1.154068112413628, -3.1569883871091178`},
  ViewVertical->{-0.03511665726833768, 
   0.9569830326406958, -0.28801092968864095`}]], "Output",
 CellChangeTimes->{
  3.820874521933754*^9, 3.8208745910396643`*^9, {3.820876528550441*^9, 
   3.8208765470184407`*^9}, {3.820876941850731*^9, 3.8208769485664024`*^9}, {
   3.8208769827008157`*^9, 3.8208769935428996`*^9}, {3.820877042083753*^9, 
   3.820877077107255*^9}, 3.820877145243068*^9, 3.8208773582273645`*^9, 
   3.8208907679473705`*^9, 3.8254574526699886`*^9, 3.8254578093066483`*^9, {
   3.8256505220239344`*^9, 3.825650527744507*^9}}]
}, Open  ]]
},
WindowToolbars->"EditBar",
WindowSize->{1600, 826},
WindowMargins->{{-8, Automatic}, {Automatic, -8}},
CellContext->Notebook,
Magnification:>1.3 Inherited,
FrontEndVersion->"11.0 for Microsoft Windows (64-bit) (2016\:5e7410\:67088\
\:65e5)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[558, 20, 651, 11, 96, "Input",
 CellGroupingRules->{"GroupTogetherGrouping", 10000.}],
Cell[1212, 33, 135, 3, 49, "Input"],
Cell[1350, 38, 1043, 19, 74, "Input"],
Cell[2396, 59, 225, 4, 49, "Input"],
Cell[CellGroupData[{
Cell[2646, 67, 502, 10, 59, "Input"],
Cell[3151, 79, 1398, 26, 144, "Output"]
}, Open  ]],
Cell[4564, 108, 334, 7, 49, "Input"],
Cell[CellGroupData[{
Cell[4923, 119, 1281, 36, 228, "Input"],
Cell[6207, 157, 580, 11, 400, "Output"]
}, Open  ]],
Cell[6802, 171, 243, 5, 49, "Input"],
Cell[CellGroupData[{
Cell[7070, 180, 7916, 204, 741, "Input"],
Cell[14989, 386, 730, 14, 594, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[15756, 405, 428, 7, 49, "Input",
 CellGroupingRules->{"GroupTogetherGrouping", 10001.}],
Cell[16187, 414, 12227, 235, 763, "Input",
 CellGroupingRules->{"GroupTogetherGrouping", 10001.}]
}, Open  ]],
Cell[CellGroupData[{
Cell[28451, 654, 2166, 58, 325, "Input"],
Cell[30620, 714, 1899, 36, 885, "Output"]
}, Open  ]]
}
]
*)

